﻿using System;
using System.ComponentModel;
using System.Runtime.InteropServices;

namespace Teigha.Core
{
	public class OdPolyPolygon3d : IDisposable
	{
		[EditorBrowsable(EditorBrowsableState.Never)]
		public OdPolyPolygon3d(IntPtr cPtr, bool cMemoryOwn)
		{
			this.swigCMemOwn = cMemoryOwn;
			this.swigCPtr = new HandleRef(this, cPtr);
		}

		[EditorBrowsable(EditorBrowsableState.Never)]
		public static HandleRef getCPtr(OdPolyPolygon3d obj)
		{
			if (obj != null)
			{
				return obj.swigCPtr;
			}
			return new HandleRef(null, IntPtr.Zero);
		}

		~OdPolyPolygon3d()
		{
			this.Dispose();
		}

		public virtual void Dispose()
		{
			if (this.swigCPtr.Handle != IntPtr.Zero)
			{
				if (this.swigCMemOwn)
				{
					lock (this.locker)
					{
						if (this.swigCPtr.Handle != IntPtr.Zero && this.swigCMemOwn)
						{
							this.swigCMemOwn = false;
							GlobalsPINVOKE.delete_OdPolyPolygon3d(this.swigCPtr);
						}
					}
					this.swigCMemOwn = false;
				}
				this.swigCPtr = new HandleRef(null, IntPtr.Zero);
			}
			GC.SuppressFinalize(this);
		}

		public OdPolyPolygon3d() : this(GlobalsPINVOKE.new_OdPolyPolygon3d(), true)
		{
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public void newContour()
		{
			GlobalsPINVOKE.OdPolyPolygon3d_newContour(this.swigCPtr);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public void addToCurrentContour(OdGePoint3d point)
		{
			GlobalsPINVOKE.OdPolyPolygon3d_addToCurrentContour(this.swigCPtr, OdGePoint3d.getCPtr(point));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public void removeLastContour()
		{
			GlobalsPINVOKE.OdPolyPolygon3d_removeLastContour(this.swigCPtr);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public void setGrowLength(int growLength)
		{
			GlobalsPINVOKE.OdPolyPolygon3d_setGrowLength(this.swigCPtr, growLength);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public void setGrowLenght(int growLength)
		{
			GlobalsPINVOKE.OdPolyPolygon3d_setGrowLenght(this.swigCPtr, growLength);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public OdGePoint3dArray points()
		{
			OdGePoint3dArray result = new OdGePoint3dArray(GlobalsPINVOKE.OdPolyPolygon3d_points__SWIG_0(this.swigCPtr), false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public OdInt32Array counts()
		{
			OdInt32Array result = new OdInt32Array(GlobalsPINVOKE.OdPolyPolygon3d_counts__SWIG_0(this.swigCPtr), false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		private object locker = new object();

		private HandleRef swigCPtr;

		protected bool swigCMemOwn;
	}
}
